<?php

class IndexController extends Zend_Controller_Action
{

    private $flashMessenger;

	public function init()
	{


    }

	public function indexAction()
	{
		unset($_SESSION['role']);
		$tUsuario = new DbTable_Usuario();
		$login = $this->_getParam("Login");
		$senha = $this->_getParam("Senha");

		if (($post = $this->_request->getPost()) != array())
		{
				$usuario = $tUsuario->fetchAll(
				array("LOGIN = ?" => $login,
					  "SENHA = ?" => $senha))->current();

				if(!empty($usuario)){
					$acesso = new Acesso($usuario->CD_PERFIL);
					$acesso->setRole();
					$this->_forward("inicio");
				}else{
                    $_SESSION['msg']['tipo'] = 'erro';
                    $_SESSION['msg']['conteudo'] = 'Usuário ou senha inválidos!';
                    $this->redirect('');
                }

		}


	}

	public function inicioAction(){
		$string= new String();
		$string->removerAcentoBanco();
	}

    public function testeAction(){
        $this->_helper->layout->disableLayout();
        $this->_helper->viewRenderer->setNoRender();


        header('Content-type: application/pdf');
        $pdf = new Cezpdf();
        $pdf->selectFont('Times-Roman.afm');
        $pdf->addText(100,100,14,'asas');

        $pdf->ezStream();

    }

}

